import java.util.Scanner;

public class three {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] s=in.next().toCharArray();
        StringBuilder st=new StringBuilder();
        for(int i=0;i<s.length;i++){
            char ch=s[i];
            if(st.length()!=0&&ch== st.charAt(st.length()-1)){
                //出栈
                st.deleteCharAt(st.length()-1);
            }else{
                //出栈
                st.append(ch);
            }
        }
        System.out.println(st.length()==0?0:st.toString());
    }
}
